<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8"/>
    <title>电子图书数据导入</title>

    <!-- Bootstrap -->
    <link href="/css/bootstrap.css" rel="stylesheet">

</head>
<body>
<div class="container">
    <h1>电子图书数据导入</h1>
    <form id="keyWordformName" name="keyWordformName" >
        <div class="row">
            <div class="col-lg-6">
                <div class="form-group">
                    <label>选中文件*</label>
                    <input id="fileUpload" name="fileUpload" type="file"/>
                </div>
            </div>
            <div class="col-lg-6">
                <div class="form-group">
                    <label>工作表名称*</label>
                    <input id="tableName" name="tableName" type="text" class="form-control" value="Sheet1"/>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-6">
                <div class="form-group">
                    <label>开始行号*</label>
                    <input id="startRow" name="startRow" type="text" class="form-control" value="0"/>
                </div>
            </div>
            <div class="col-lg-6">
                <div class="form-group">
                    <label>结束行号*</label>
                    <input id="endRow" name="endRow" type="text" class="form-control" value=""/>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-6">
                <div class="form-group">
                    <label>开始列号*</label>
                    <input id="startCol" name="startCol" type="text" class="form-control" value="0"/>
                </div>
            </div>
            <div class="col-lg-6">
                <div class="form-group">
                    <label>结束列号*</label>
                    <input id="endCol" name="endCol" type="text" class="form-control" value="28"/>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-6">
                <div class="form-group">
                    <label>跳出行标识 </label>
                    <input id="rowSign" name="rowSign" type="text" class="form-control" value=""/>
                </div>
            </div>
            <div class="col-lg-6">
                <div class="form-group">
                    <label>跳出工作表行标识</label>
                    <input id="tnSign" name="tnSign" type="text" class="form-control" value=""/>
                </div>
            </div>
        </div>
        <button type="button" class="btn btn-default" onclick="importExcel()">提交</button>
    </form>

</div>


</body>


<script src="/js/jquery.js"></script>
<script src="/js/bootstrap.js"></script>

<script>

    function importExcel() {
        var tableNmae = $("#tableName").val();
        var startRow = $("#startRow").val();
        var endRow = $("#endRow").val();
        var startCol = $("#startCol").val();
        var endCol = $("#endCol").val();
        var fileUpload = $('#fileUpload').get(0).files[0];
        if(!tableNmae.trim() || !startRow.trim() || !endRow.trim() || !startCol.trim() || !endCol.trim() || !fileUpload){
            alert("请完整填写必填项！！")
            return;
        }
        var formData = new FormData(document.getElementById("keyWordformName"));
        $.ajax({
            type: "post",
            url: "/dztsImportData",
            data: formData,
            processData: false,
            contentType: false,
            success: function (data) {
                alert(data);
            },
            error: function (data) {
                alert("请求失败");
            }
        });
    }

</script>

</html>